package team.archai.nexus.boot.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import team.archai.nexus.boot.enums.AuthEnum;

import java.util.LinkedHashMap;

/**
 * @description: filter 配置
 * @author: lishibin
 * @create: 2020-06-26 23:25
 **/
@Data
@Component
@ConfigurationProperties(prefix = "archai-nexus.auth")
public class AuthProperties {

    /**
     * 默认的filter链
     */
    private LinkedHashMap<String, String> defaultFilterChain;

    /**
     * 自定义filter链 优先级低于内置的
     */
    private LinkedHashMap<String, String> filterChain;

    /**
     * @program: AuthProperties
     * @description: 登录url
     * @author: lishibin
     * @create: 3:05 PM
     **/
    private String loginUrl;

    /**
     * @program: AuthProperties
     * @description: 认证成功url
     * @author: lishibin
     * @create: 3:05 PM
     **/
    private String successUrl;

    /**
     * @program: AuthProperties
     * @description: 未认证url
     * @author: lishibin
     * @create: 3:04 PM
     **/
    private String unauthorizedUrl;

    /**
     * @program: AuthProperties
     * @description: 开启全局校验
     * @author: lishibin
     * @create: 3:04 PM
     **/
    private boolean globalAuth;

    /**
     * @program: AuthProperties
     * @description: token认证时间 单位 s
     * @author: lishibin
     * @create: 6:10 PM
     **/
    private long timeout;

    /**
     * @program: AuthProperties
     * @description: 登录页面
     * @author: lishibin
     * @create: 12:25 AM
     **/
    private String loginPage;

    /**
     * @program: AuthProperties
     * @description: 退出接口
     * @author: lishibin
     * @create: 12:26 AM
     **/
    private String logoutUrl;

    /**
     * @program: AuthProperties
     * @description: 应用密钥
     * @author: lishibin
     * @create: 1:10 AM
     **/
    private String appSecret;

    /**
     * @program: AuthProperties
     * @description: 认证类型 shiro 或者 secret
     * @author: lishibin
     * @create: 21:50
     **/
    private AuthEnum type;

    /**
     * @program: AuthProperties
     * @description: 启用缓存
     * @author: lishibin
     * @create: 18:05
     **/
    private Boolean enableCache;

    /**
     * @program: AuthProperties
     * @description: 密钥
     * @author: lishibin
     * @create: 19:21
     **/
    private String secretKey;
}
